package com.wx.javacode.extend_;

public class ExtendsTheory {
    public static void main(String[] args) {
        Son son = new Son();
        System.out.println(son.getAge());
        System.out.println(son.hobby);
    }
}

class GrandPa {
    String name = "爷爷";
    String hobby = "游泳";
}

class Father extends GrandPa {
    String name = "爸爸";
    private int age = 30;
    public int getAge(){
        return age;
    }
}

class Son extends Father {
    String name = "儿子";
}
